{% extends "xBlog/base.html" %}
{% load xBlog_filter %}
{% block content %}
    <div class="row-fluid">
        {% include 'xBlog/sidebar.html' %}
        <div class="span9" id="idarticle">
            {% for post in post_list %}
                <div class="well">
                    <div>
                        <h2><a href="{% url 'detail' article_id=post.id %}" title="点击阅读详细内容">{{ post.title }}</a>
                        <span class="pull-right"
                              style="font-size:16px;font-weight:bolder;padding-top:7px;">{{ post.date_time|date:"Y-m-d H:i" }}</span>
                        </h2>
                    </div>
                    <div style="word-wrap:break-word;">
                        <p>
                            {{ post.content|sub_content:150|custom_markdown }}
                        </p>
                    </div>
                    <div style="margin-top:15px;">
                        {% if post.catagory %}
                            <span class="label label-inverse">
                    <a href="{% url 'catagories' catagory_name=post.catagory.catagory_name %}"
                       title="{{ post.catagory.catagory_name }}分类文章">#{{ post.catagory.catagory_name }}#</a> </span>
                        {% endif %}

                        <span>&nbsp;&nbsp;</span>
                        {% if post.tags.all %}
                            {% for tag in post.tags.all %}
                                <span class="label label-inverse">
                    <a href="{% url 'tags' tag_name=tag.tag_name %}"
                       title="{{ tag.tag_name }}分类文章">#{{ tag.tag_name }}#</a></span>
                            {% endfor %}
                        {% endif %}
                        <span class="pull-right">
                <a href="{% url 'detail' article_id=post.id %}#comments" title="点击查看文章评论" style="margin-right:15px;">评论[{{ post.comment_set.all|length }}]</a>
                <a href="{% url 'detail' article_id=post.id %}" title="点击阅读详细内容">阅读全文[{{ post.visit_count }}]</a></span>
                    </div>
                </div>
            {% endfor %}

            <div class="pagination pull-right">
                <ul>
                    {% if post_list.has_previous %}
                        <li><a href="?page=1{% if keyword %}&keyword={{ keyword }}{% endif %}" title="首页">首页</a></li>
                        <li><a href="?page={{ post_list.previous_page_number }}{% if keyword %}&keyword={{ keyword }}{% endif %}">上一页</a></li>
                    {% endif %}
                    {% if post_list.has_previous or post_list.has_next %}
                        <li class="active"><a href="javascript:void(0)">第{{ post_list.number }}页</a></li>
                    {% endif %}
                    {% if post_list.has_next %}
                        <li><a href="?page={{ post_list.next_page_number }}{% if keyword %}&keyword={{ keyword }}{% endif %}">下一页</a></li>
                        <li><a href="?page={{ post_list.paginator.num_pages }}{% if keyword %}&keyword={{ keyword }}{% endif %}"
                               title="共{{ post_list.paginator.num_pages }}页">末页</a></li>
                    {% endif %}
                </ul>
            </div>
            <!--pagination-->
        </div><!--span9-->
    </div>
    <script>
        $('#sitename').addClass('animated lightSpeedIn');
    </script>
{% endblock %}